package se19team1e.search;

import se19team1e.entity.JobAdvertDTO;
import se19team1e.search.props.JobAdvertPropertySearchEngine;

/**
 * An abstract factory that creates SearchEngine instances. 
 * 
 * <p>
 * This class is introduced to ease controller unit testing, such that it does not need to create/interact with any real search engines.
 * </p>
 * 
 * @author Arun Manivannan
 *
 */
public class SearchEngineFactory {

    /**
     * Creates the actual SearchEngine that implements the ISearchEngine interface.
     * @return SearchEngine instance to use.
     */
    public static SearchEngine< JobAdvertDTO, String > getSearchEngine(String searchImpl){
    	
		if (searchImpl.equals("Properties")) {
			return JobAdvertPropertySearchEngine.getInstance(); 
		} else {
			throw new IllegalArgumentException("Unsupported search engine implementation.");
		}
    }
    

}
